package cn.xgj.sfzy.controller;

import cn.xgj.sfzy.entity.CourseCollect;
import cn.xgj.sfzy.service.CourseCollectService;
import cn.xgj.sfzy.util.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName CourseCollectController
 * @Description TODO
 * @Author gcc
 * @Date 2024年10月31日 19:43
 * @Version 1.0
 */
@RestController
@RequestMapping("/courseCollect")
public class CourseCollectController {
    @Autowired
    private CourseCollectService courseCollectService;
    @GetMapping("/findByUserId")
    public Result findByUserId(@Param("userId") Long userId){
        List<CourseCollect> list = courseCollectService.findByUserId(userId);
        if (list.size()==0){
            return Result.error("查询失败");
        }
        return Result.success(list);
    }
}
